import React, { Component, Fragment } from 'react'
import EditSingle from './EditSIngle'
import EditRadio from './EditRadio'
import EditMultiline from './EditMultiline';
import EditCheckBox from './EditCheckBox';

export default class SubjectShow extends Component {
    render() {
        return (
            <Fragment>
                {
                    this.props.addSubjectList.map((item, index) => {
                        var temp;
                        switch (item.type) {
                            case 'radio':
                                temp = <div style={{
                                    width: 1200,
                                    backgroundColor: '#fff',
                                    marginTop: 20,
                                    boxShadow: '0 2px 4px 0 rgba(0,0,0,.1)',
                                }} key={index}>
                                    <EditRadio
                                        index={item.index}
                                        title={item.title}
                                        options={item.options}
                                        handleInputData={this.props.handleInputData}
                                        obj={item}
                                        isSubmit={this.props.isSubmit}
                                    />
                                </div>
                                break;
                            case 'checkBox':
                                temp = <div style={{
                                    width: 1200,
                                    backgroundColor: '#fff',
                                    marginTop: 20,
                                    boxShadow: '0 2px 4px 0 rgba(0,0,0,.1)',
                                }} key={index}>
                                    <EditCheckBox
                                        index={item.index}
                                        title={item.title}
                                        options={item.options}
                                        handleInputData={this.props.handleInputData}
                                        isSubmit={this.props.isSubmit}
                                        obj={item}
                                    />
                                </div>
                                break;
                            case 'multiline':
                                temp = <div style={{
                                    width: 1200,
                                    backgroundColor: '#fff',
                                    marginTop: 20,
                                    boxShadow: '0 2px 4px 0 rgba(0,0,0,.1)',
                                }} key={index}>
                                    <EditMultiline
                                        index={item.index}
                                        title={item.title}
                                        key={index}
                                        handleInputData={this.props.handleInputData}
                                        isSubmit={this.props.isSubmit}
                                        obj={item}
                                    />
                                </div>
                                break;
                            case 'singleText':
                                temp = <div style={{
                                    width: 1200,
                                    backgroundColor: '#fff',
                                    marginTop: 20,
                                    boxShadow: '0 2px 4px 0 rgba(0,0,0,.1)',
                                }} key={index}>
                                    <EditSingle
                                        index={item.index}
                                        title={item.title}
                                        key={index}
                                        handleInputData={this.props.handleInputData}
                                        isSubmit={this.props.isSubmit}
                                        obj={item}
                                    />
                                </div>
                                break;
                            default:
                                break;
                        }
                        return temp;
                    })
                }
            </Fragment>
        )
    }
}
